package net.itxxw.manage_cms;

import net.itxxw.framework.interceptor.FeignClientInterceptor;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.http.client.OkHttp3ClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;
@EnableDiscoveryClient  //表示是EureKa注册端的一个服务
@SpringBootApplication
@EntityScan("net.itxxw.framework.domain.cms")//扫描实体类
@ComponentScan(basePackages={"net.itxxw.api"})//扫描接口
@ComponentScan(basePackages={"net.itxxw.manage_cms"})//扫描本项目下的所有类
@ComponentScan(basePackages = {"net.itxxw.framework"})//扫描common工程下的类
public class ManageCmsApplication {
    public static void main(String[] args) {
        SpringApplication.run(ManageCmsApplication.class,args);
    }

    @Bean
    public RestTemplate restTemplate() {
        return new RestTemplate(new OkHttp3ClientHttpRequestFactory());
    }

    //Feign拦截器
    @Bean
    public FeignClientInterceptor feignClientInterceptor(){
        return new FeignClientInterceptor();
    }
}
